﻿using System;
using System.Data;

namespace wuliuback
{
    public partial class CheckFavorite : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            string userId = Request["user_id"];
            string type = Request["type"];//货源1，车源2，用户3
            string favoriteId=Request["favorite_id"];
            
            string code = "";
            string msg = "";
            string favorite_flag = "";

            String sql = "";
            sql = "select * from t_favorite where user_id='"+userId+"' and type='"+type+"' and favorite_id='"+favoriteId+"' and status =0";
            
            DbHelper dbHelper = new DbHelper();
            DataSet dataSet = dbHelper.Select(sql);
            DataTable table = dataSet.Tables[0];
            if (table.Rows.Count>0)
            {
                code = "0";
                msg = "已收藏";
                favorite_flag = "1";
            }
            else
            {
                code = "0";
                msg = "未收藏";
                favorite_flag = "0";
            }

            Response.Output.WriteLine("{\"code\":\"" + code + "\",\"msg\":\"" + msg + "\",\"favorite_flag\":\"" + favorite_flag + "\"}");
        }

    }
}
